package cn.ekuma.sync;

import java.util.Date;
import java.util.List;

import com.openbravo.data.basic.BasicException;

import cn.ekuma.data.dao.I_DataLogic;

public class SyncManager {
	I_DataLogic src;
	I_DataLogic dest;
	
	
	   
   public SyncManager(I_DataLogic src, I_DataLogic dest) {
		this.src = src;
		this.dest = dest;
	}

public void sync(Class c) throws BasicException{
	   sync(c,null,null);
	}
   
	public void sync(Class c,Date start,Date end) throws BasicException{
			List objs=src.listWithDateTime(c, start, end);
			if(!objs.isEmpty()){
				dest.insertOrUpdate(objs);
			}
	}
	
	
	public static interface ProcessListener{
		void processed(int percent);
	}
 }
